package com.kob.design.singleton.lazy;

/**
 * @Description: 懒汉式 ，线程安全,双重检查锁
 * @Author: fyt
 * @Date: 2024/4/15 19:20
 **/
public class Singleton3 {
    private Singleton3() {
    }
    private static volatile Singleton3 instance;

    public static Singleton3 getInstance() {

        if (instance == null) {
            synchronized (Singleton3.class){
                if(instance==null){
                    instance = new Singleton3();
                }
            }

        }
        return instance;
    }
}
